load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "membuf",
    srcs = [
        "buffer.go",
        "limiter.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/membuf",
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_pingcap_log//:log",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "membuf_test",
    timeout = "short",
    srcs = [
        "buffer_test.go",
        "limiter_test.go",
    ],
    embed = [":membuf"],
    flaky = True,
    shard_count = 6,
    deps = [
        "@com_github_stretchr_testify//require",
        "@org_uber_go_atomic//:atomic",
    ],
)
